import { request } from "@/utils/request";

export const UserApi = {
  login: (data: { email: string; password: string }) =>
    request.post<any>("/api/users/login", data),

  register: (data: {
    email: string;
    invitationCode: string;
    password: string;
  }) => request.post<any>("/api/users/register", data),
  wallet: () => request.get<any>("/api/users/wallet", {}),
  getMessage: (data: { page: number; size: number }) =>
    request.get<any>(`/api/users/messages`, data),
  readMessage: (id: any) =>
    request.put<any>(`/api/users/messages/${id}/read`, {}),
  setPassword: (data: { oldPassword: string; newPassword: string }) =>
    request.post<any>(`/api/users/password`, data),
  getHasPayPassword: () => request.get<any>(`/api/users/has-payment-password`),
  setPayPassword: (data: {
    paymentPassword: string;
    oldPaymentPassword: string;
  }) => request.post<any>(`/api/users/payment-password`, data),
  getBankCard: () => request.get<any>(`/api/users/bank-cards`),
  addBankCard: (data: {
    bankName: string;
    accountNumber: string;
    accountHolder: string;
    accountType: string;
    phoneNumber: string;
    email: string;
    currency: string;
  }) => request.post<any>(`/api/users/bank-cards`, data),
  handleWithdraw: (data: {
    amount: number;
    bankCardId: number;
    paymentPassword: string;
  }) => request.post<any>(`/api/users/withdraw`, data),
  getHasUserInfo: () => request.get<any>(`/api/users/has-user-info`),
  setUserAuthentication: (data: {
    gender: number;
    birthday: string;
    documentType: number;
    documentNumber: string;
    surname: string;
    name: string;
    documentFront: string;
    documentBack: string;
    userId: number;
  }) => request.post<any>(`/api/users/user-info`, data),
};
